<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="dao.DaoFactory"%>
<%@page import="service.IUserDao"%>
<%@page import="bean.User" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>显示用户信息</title>
   <script>
   	function fun(val){
   		var r=confirm("确认删除吗？");
   		if(r){
   			location.href="UserServlet?op=del&id="+val;
   		}
   	}
   </script>
   <style>
   a{
    		text-decoration: none;
    		
    	}
   </style>
   
  </head>
  
  <body>
  <div>
		<form action="UserServlet?op=select" method="post"
			 class="search">
			<input style="border-radius: 0px; width: 328px;" name="searchText"
				type="text" placeholder="请输入用户编号或姓名">
			<input name="查询用户"
				type="submit" value="查询用户">
		</form>

	</div>
    <center>
     <table border="1" style="border:2px solid RGB(73,161,225)">
		<tr>
    			<th width="100">编号</th>
    			<th width="100">用户名</th>
    		    <th width="100">密码</th>
				<th width="100">性别</th>
				<th width="100">年龄</th>
				<th width="100">爱好</th>
				<th width="100">签名</th>

    			<th colspan="2" width="200">操作</th>
    		</tr>
			<c:forEach var="User" items="${userList}">
				<tr align="center">

					<td>${User.id}</td>
					<td>${User.name}</td>
					<td>${User.password}</td>
					<td>${User.sex}</td>
					<td>${User.age}</td>
					<td>${User.hobby}</td>
					<td>${User.sign}</td>
					<td><a href="updateUser.jsp?id=${User.id}&op=update">更新</a></td>
    				<td><a href="javascript:void(0);" onclick="fun(${User.id})">删除</a></td>
				</tr>
			</c:forEach>
		</table>
    </center>
  </body>
</html>
